package com.fy.fyzf.presenter;

import com.fy.fyzf.api.SubscriberCallBack;
import com.fy.fyzf.base.BasePresenter;
import com.fy.fyzf.bean.AddOwner;
import com.fy.fyzf.bean.LookOwnerBean;
import com.fy.fyzf.bean.OwnerListBean;
import com.fy.fyzf.bean.BaseData;
import com.fy.fyzf.view.OwnerListCallBack;

public class OwnerListPresenter extends BasePresenter<OwnerListCallBack> {

    public OwnerListPresenter(OwnerListCallBack view) {
        super(view);
    }

    public void getOwnerList(LookOwnerBean lookOwnerBean){
        addSubscription(mApiService.listOwner(lookOwnerBean), new SubscriberCallBack<BaseData<OwnerListBean>>(mView,true) {
            @Override
            protected void onSuccess(BaseData<OwnerListBean> response) {
                mView.getOwnerListSuccess(response.data);
            }

            @Override
            protected void onError() {

            }
        });
    }

    public void addOwner(AddOwner addOwner){
        addSubscription(mApiService.addOwner(addOwner), new SubscriberCallBack<BaseData>(mView,true) {
            @Override
            protected void onSuccess(BaseData response) {
                mView.addOwnerSuccess(response);
            }

            @Override
            protected void onError() {

            }
        });
    }

}
